body {
color: #333333;
line-height: 1.5;
}
h1,h2{
color: #666666;
font-weight: bold;
margin-top: 1em;
##My meme
Here is a meme picturte I created, the content is originally from a post i saw asking what is the best days of your life,and someone said this which I feel the same, and I used a suitable picture to make this thought a meme
pic :)
```r
# Load the magick library
library(magick)
# Read the image
url <- "https://github.com/Billy0215/stats220/blob/main/cat.jpg?raw=true"
meme <- image_read(url)
# Create an image with black text on a transparent background for the white cat
white_cat_text <- "Mom picking me up from school"
white_cat_text_image <- image_blank(500, 500, "transparent") %>%
image_annotate(white_cat_text, size = 28, color = "black", gravity = "center")
# Combine the background image with the text image on the white cat.
final_meme <- image_composite(meme, white_cat_text_image, offset = "+500+100")
# Create an image with black text on a transparent background for the small cat
small_cat_text <- "Me telling her what happened in school today"
small_cat_text_image <- image_blank(500, 500, "transparent") %>%
image_annotate(small_cat_text, size = 24, color = "black", gravity = "center")
# Combine the final meme with the text image on the small cat.
final_meme <- image_composite(final_meme, small_cat_text_image, offset = "+600+400")
# Create an image with black text on a white background for the bottom text
bottom_text <- "Best days of my life"
bottom_text_image <- image_blank(400, 150, "white") %>%
image_annotate(bottom_text, size = 45, color = "black", gravity = "center")
# Append the bottom text image to the final meme.
final_meme <- image_append(c(final_meme, bottom_text_image), stack = TRUE)
# Save the meme as a PNG file
image_write(final_meme, "my_meme.png")
##My animated GIF
Here is a animated GIF I created, it has a loop of 4 frames of pictures, picture changes when it comes to the next frame. The content is some scenes from one of my favorite video game “Disco Elysium”
# Load the magick library
library(magick)
# Read the images
url1 <- "https://github.com/Billy0215/stats220/blob/main/DiscoElysium0.jpg?raw=true"
url2 <- "https://github.com/Billy0215/stats220/blob/main/DiscoElysium1.jpg?raw=true"
url3 <- "https://github.com/Billy0215/stats220/blob/main/DiscoElysium2.png?raw=true"
url4 <- "https://github.com/Billy0215/stats220/blob/main/DiscoElysium3.jpg?raw=true"
image1 <- image_read(url1)
image2 <- image_read(url2)
image3 <- image_read(url3)
image4 <- image_read(url4)
# Resize the images to the same size and fill the blanks
resize_and_fill <- function(img) {
img %>%
image_resize("1280x900!") %>%
image_flatten()
}
image1 <- resize_and_fill(image1)
image2 <- resize_and_fill(image2)
image3 <- resize_and_fill(image3)
image4 <- resize_and_fill(image4)
# Combine frames into an GIF
animation <- image_join(c(image1, image2, image3, image4))
# Set delay between frames and loop the animation
animated_gif <- image_animate(animation, fps = 1, dispose = "previous", loop = 0)
# Save the GIF
image_write(animated_gif, "my_animation.gif")